Component({
    properties: {
        value:{type:String, value:''},
        placeholder:{type:String, value:''},
        prefixIcon:{type:String,value:''},
        suffixIcon:{type:String,value:''},
        maxlength:{type:Number,value:  140},
        type:{
            type:String, value:'text',
            observer(data){
                let type = data
                let password = false
                if (data == 'password'){
                    type = 'text'
                    password = true
                }
                this.setData({
                    _type: type,
                    _passwordType: password,
                })
            }
        },
    },
    data: {
        _passwordType:false,
        _type:'text',
    },
    methods: {
        togglePassword(){
            const {_passwordType} = this.data
            this.setData({
                _passwordType: !_passwordType
            })
        },
        inputChange(e){
            this.triggerEvent('input',e.detail)
        }
    }
});
